﻿Partial Public Class ButtonClickEventUserControl

#Region "Events"
    Private Sub ButtonBackgroundColor_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Try
            Dim l_button = CType(sender, Button)
            Dim l_event = CType(Me.DataContext, EventBase)
            Dim l = New System.Windows.Forms.ColorDialog
            If l.ShowDialog = Forms.DialogResult.OK Then
                Dim l_color = l.Color

                Dim l_mediaColor = System.Windows.Media.Color.FromArgb(l_color.A, l_color.R, l_color.G, l_color.B)
                l_event.BackgroundColor = l_mediaColor
                l_button.Background = New SolidColorBrush(l_mediaColor)
                l_event.GuiRectangle.Rectangel.Fill = New SolidColorBrush(l_mediaColor)

            End If
        Catch ex As Exception

        End Try
       
    End Sub

    Private Sub textBlockOnClickColor_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Try
            Dim l_event = CType(Me.DataContext, EventBase)
            Dim l_button = CType(sender, Button)
            Dim l = New System.Windows.Forms.ColorDialog
            If l.ShowDialog = Forms.DialogResult.OK Then
                Dim l_color = l.Color

                Dim l_mediaColor = System.Windows.Media.Color.FromArgb(l_color.A, l_color.R, l_color.G, l_color.B)
                l_event.OnClickEfectColor = l_mediaColor
                l_button.Background = New SolidColorBrush(l_mediaColor)

            End If
        Catch ex As Exception

        End Try
       
    End Sub

    Private Sub Text_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.TextChangedEventArgs)
        Try
            Dim l_event = CType(Me.DataContext, EventBase)
            Dim l_TextBox = CType(sender, TextBox)
            l_event.Text = l_TextBox.Text
            l_event.GuiRectangle.TextBlock.Text = l_event.Text
            l_event.GuiRectangle.TextBlock.FontStretch = FontStretches.Expanded
        Catch ex As Exception

        End Try
        

    End Sub



#End Region
   
   
  
End Class
